package main;

import java.io.IOException;

import java.util.concurrent.Callable;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
/**
 * Retriever- retirves pages from the PageToRetireveBUffer and adds them to the PageBuffer
 * @version 5-11-2012
 * @author T. Lewis & Ken Norton BitWiseGuys.
 * 
 * */
public class Retriever implements Callable<WebPage>{
	private String my_url;
	public Retriever(String url){
		my_url = url;	
	}

	@Override
	public WebPage call() {
		Document doc = null;
		boolean dummy = false;

		try {
			doc = Jsoup.connect(my_url).timeout(1000).followRedirects(false).get();
		} catch (IOException e) {

			dummy = true;
		}

		if (dummy == false){
			return new WebPage(my_url,doc);
		} else {
			return new WebPage(("Dummy"),new Document("Dummy"));
		}
	}
}
